package package1;

import java.util.*;

public class loop {
    public static void main(String[] args) {
        day();
        day1();
        day2();
        day3();
    }

    private static void day3() {
        Integer[] a = {23, 523, 12, 34, 653, 2};
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < a.length -i-1; j++) {
                if (a[j] > a[j + 1]) {
                    a[j] = a[j]^a[j+1];
                    a[j+1] = a[j]^a[j+1];
                    a[j] = a[j]^a[j+1];
                }
            }
        }
        //升序降序排列
        //Arrays.sort(a,Collections.reverseOrder());
        System.out.println(Arrays.toString(a));
    }

    private static void day2() {
        int[] a = {1, 2, 3, 4, 5, 6, 7, 7, 8, 7};
        for (int i = 0; i < a.length; i++) {
            System.out.println((i + 1) + "月份有：" + a[i] + "天");
        }
    }

    private static void day1() {
        int[] a = new int[50];
        for (int i = 0; i < a.length; i++) {
            a[i] = i + 1;
            System.out.println(a[i]);
        }
    }

    private static void day() {
        int[] a = new int[6];
        for (int i = 0; i < a.length; i++) {
            a[i] = new Random().nextInt(100);
            System.out.print(a[i] + "\t");
        }
    }
}
